<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


<%@ page language="java" import="OnlineExam.*" %>

<%  
	String testId = request.getParameter ("testId");
	Test test = Test.retrieveTest(testId);
%>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<TITLE>Answer Paper for <%= test.getUsername() %></TITLE>
<link rel="stylesheet" type="text/css" href="style.css" media="screen" /
<body>
<jsp:include page="common/header.jsp"/>
<center><h2><b>Category : <%= test.getCategoryId() %></b></h2></center><br>
<center><table><tr><td><b>TestId : <%= test.getTestId() %></b></td></table></center><br><br>
<%@page language="java" import="OnlineExam.*, OnlineExam.question.*, java.util.*"%>
<% 
	List<QuestionAnswer> list = test.retrieveGivenAnswers ();	
	int i = 0;
	for (ListIterator iter = list.listIterator(); iter.hasNext();)
	{
		QuestionAnswer qa = (QuestionAnswer) iter.next();
		Question question = Question.retrieveQuestion (qa.getQuestionNumber());
%>
		<b>Question: <%=(i + 1)%> <br /><br /><%=question.getQuestion()%> </b><br/><br/>

<%          
		String[] answers = question.splitOptions();
     	for (int j = 0; j < answers.length; j++)
     	{
%>			
			<b><%=(j+1)%>.)  </b><%= answers[j]%><br /><br/>
			
<%
		}
		if (qa.getAnswer() == null)
		{
%>	
		<br/><br/><b>The question is not answered</b><br/><br /><br />
<%
		}
		else
		{
%>
		<br/><br/><b>The Given Answer is : </b><%=qa.getAnswer()%> <br /><br /><br />
<% 
		}
%>
		<b>Marks Awarded : </b><%= qa.getMarksScored() %> <b>out of</b> <%= qa.getMaximumMarks() %> <br /><br />
<%
   		if (!(question.needsExplanation()))
   		{
%>	  
			<br /><font color="red"><td><b>The Correct Answer is : </b></td> A<%= question.getCorrectAnswer() %></font><br /><br />
			<hr />
<% 
		}
   		else 
		{
			if (qa.getExplanation () == null)
			{
%>			<br/><br/><td><b>Explanation not given</b>
<%
			}
			else
			{
%>
			<br/><br/><td><b>Given the Explanation for the Answer : </b></td><br />
			<td><%= qa.getExplanation() %></td><br/><br/>
<%
			}
%>
			
			<br /><font color="red"><td><b>The Correct Answer is :</b></td> A<%= question.getCorrectAnswer() %></font>
			<br /><font color="red"><td><b>The Explanation : </b></td><%= question.getExplanation() %> <br /></font>
			<br /><font color="blue"><b>The Evaluator's Comment : </b>
			<br /><%= qa.getEvaluatorsComment() %></font><br /><br />
			<hr /> 

<%
		}
		i++;
	}
%>
</tr>
<br />
<input type="Button" value="Close" onClick="window.close()">
</div>
</div>
</body>
</html>
